package com.demo;

import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

//参考：https://blog.csdn.net/hanys_csdn/article/details/80232262
//参考：https://blog.csdn.net/daimin1/article/details/119060187
public class PropertiesUtil {
    private static final Properties properties = new Properties();

    static {
        try {
            InputStream is = PropertiesUtil.class.getClassLoader().getResourceAsStream("db.properties");
            properties.load(is);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    //根据key(键)获取value(值)
    public static String getValue(String key){
        return properties.getProperty(key);
    }
}
